var echo = echo || false;
if (echo) {
	echo.init({
	    offset: 100,
        unload: false,
	    throttle: 250, //延迟几秒加载
        callback: function (element, op) {
            element.style.display = 'none'
            element.onload = function(){
            	element.style.display = 'block';
            	element.parentNode.style.background = 'none';
            }
            // console.log(element, 'has been ', op + ' ok')
        }
	});
}

/**
* 回到顶部
*/
!function(){
	var scroll_top_btn = document.getElementById('scrollUp');
	if(scroll_top_btn){
		var timer = null;
		document.onscroll = function(){
			var scroll_top = document.body.scrollTop;
			clearTimeout(timer);
			if (scroll_top >= 50) {
				timer = setTimeout(function(){
					scroll_top_btn.style.display = 'block';
				}, 200);
			} else {
				timer = setTimeout(function(){
					scroll_top_btn.style.display = 'none';
				}, 200);
			}
		}

		scroll_top_btn.onclick = function(){
			document.documentElement.scrollTop = document.body.scrollTop = 0;
		};
	}
}();



// grab an element
var myElement = document.querySelector(".headroom");
if(myElement){
	// construct an instance of Headroom, passing the element
	var headroom  = new Headroom(myElement);
	// initialise
	headroom.init();
}
